package com.wen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wen.pojo.Merchant;
import com.wen.pojo.dto.MerchantDto;
import com.wen.pojo.dto.MerchantStatisticsView;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MerchantMapper extends BaseMapper<Merchant> {

//    @Select("SELECT * FROM consumer a,merchant merchants WHERE a.consumer_id = merchants.consumer_id AND a.status='s001-1' AND merchants.status='c001-1'")
//    List<MerchantDto> sel();


    @Select("SELECT SUM(`subtotal`) sumPrice,SUM(amount) sumAmount,MONTH(`createTime`) MONTH FROM orders o INNER JOIN `order_details` od ON o.id =od.orders_id WHERE od.back_state =1 AND o.merchant_id=#{id} GROUP BY o.id ")
    List<MerchantStatisticsView> MerchantStatistics(Integer merchantId);

}
